package com.bjpowernode.pmes.web.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.bjpowernode.pmes.util.Const;

/**
 * 服务器启动监听器
 * @author Administrator
 *
 */
public class ServerStartupListener implements ServletContextListener {

	public void contextDestroyed(ServletContextEvent arg0) {

	}

	public void contextInitialized(ServletContextEvent evt) {
		// 获取web应用对象
		ServletContext application = evt.getServletContext();
		
		// 获取web应用路径
		String appPath = application.getContextPath();
		
		// 将路径保存在应用对象范围内
		application.setAttribute(Const.APP_PATH, appPath);
	}

}
